import {
  TableResponseData,
  TokenRequestData,
  OptionsType,
  BindAndReturnAddressType
} from '@/types/interface'
import {
  BizType,
  DepositType,
  RentTimeType,
  IncludedBatteryType,
  PayAfterUse,
  VoltageType,
  RentTimeNameType
} from '@/types/enum'
import { StoreTableCol } from '@/api/store/types/store'
import { batterySizeType } from '@/api/bike/types/bike'
/**
 * 查询换电套餐
 */
export interface queryProductRequestData extends TokenRequestData {
  storeId: string
  name: string
}
export interface supportDepositType {
  name: string
  depositType: DepositType
  depositDescription: string
  freeDeposit: boolean
  deposit: string
  originDeposit: string
  creditScore: string
}
export interface queryProductTableCol {
  bizType: BizType
  productType: string
  name: string
  shortName: string
  tags: string
  imageUrls: string
  productDescription: string
  storeId: string
  supportDepositTypes: supportDepositType[]
  inputVoltage: string
  includeBattery: string
  deposit: string
  rent: string
  originRent: string
  rentTime: string
  rentTimeDescription: string
  rentCount: string
  status: string
}

export type queryProductResponseData = TableResponseData<queryProductTableCol>
export type queryProductResponse = ApiResponseData<queryProductResponseData>

/** 查询长租套餐 */

export interface queryBikeProductRequestData extends TokenRequestData {
  storeId: string
  productName: string
  bikeModel: string
  voltage: VoltageType | ''
  depositType: DepositType | ''
  rentTime: RentTimeType | ''
}
export type productParasType = Record<string, any>
export type rentablePeriodType = Record<string, any>
export interface queryBikeProductTableCol {
  bizType: BizType
  productType: string
  name: string
  shortName: string
  tags: string
  imageUrls: string
  productDescription: string
  storeId: number
  storeInfo: StoreTableCol
  supportDepositTypes: supportDepositType[]
  productModel: string
  inputVoltage: string
  includeBattery: IncludedBatteryType
  rentablePeriod: null | rentablePeriodType[]
  productParas: productParasType[]
  deposit: number
  rent: number
  originRent: number
  rentTime: RentTimeType
  rentTimeDescription: string
  rentCount: number
  bindAddress: BindAndReturnAddressType[]
  returnAddress: BindAndReturnAddressType[]
  status: number
  overdueAmount: string
  payAfterUse: PayAfterUse
  distance: number
}
export type queryBikeProductResponseData = TableResponseData<queryBikeProductTableCol>
export type queryBikeProductResponse = ApiResponseData<queryBikeProductResponseData>

/**
 * 获取套餐名称及型号
 */

export interface getProductRequestData extends TokenRequestData {
  storeId: string
  name?: string
}
export interface getProductResponseData {
  name: OptionsType[]
  model: OptionsType[]
}
export type getProductResponse = ApiResponseData<getProductResponseData>

/**
 * 获取长租套餐地图 (通过地图查询)
 * @param range 查询范围 公里数
 */
export interface queryProductByMapRequestData extends TokenRequestData {
  voltage: VoltageType | ''
  depositType: DepositType | ''
  rentTime: RentTimeType | ''
  longtitude: number
  latitude: number
  range: number | ''
}

export type queryProductByMapTableCol = queryBikeProductTableCol

export type queryProductByMapResponseData = queryProductByMapTableCol[]
export type queryProductByMapResponse = ApiResponseData<queryProductByMapResponseData | string>

/**
 * @description 查看车辆租赁套餐详情
 * @param name - 套餐名称
 */
export interface queryStoreProductDetailRequestData extends TokenRequestData {
  storeId: string
  name: string
}

export interface RentTimeTableCol {
  rentTime: RentTimeNameType //周期
  price: string //价格
  deposit: string //押金
  depositType: string //免押配置
  overdueAmount: string //逾期费
  payAfterUse: string //先用后付
  canUseCoupon: string //优惠券
  rentEquity: string //租赁权益
}
export interface queryStoreProductDetailResponseData {
  images: string
  productParas: Record<string, any>
  rentTime: RentTimeTableCol[]
  batterySize: batterySizeType[]
}

export type queryStoreProductDetailResponse = ApiResponseData<queryStoreProductDetailResponseData>
